package com.kinghood.productcenter.common.model.enums.product;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum BusinessLogTypeEnum {
    PRODUCT(1, "商品"),
    SKU(2, "SKU");

    private Integer type;
    private String name;

    BusinessLogTypeEnum(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    public static Integer getTypeByName(String name) {
        for (BusinessLogTypeEnum e : values()) {
            if (Objects.equals(name, e.getName())) {
                return e.getType();
            }
        }
        return null;
    }
}
